import { Routes, Link, useRoutes, useNavigate } from "react-router-dom"
//自定义的守卫
import useRoutesWithGuard from "./router/useRoutesWithGuard"
//引入路由的配置内容
import routes from "./router/config"
const App = () => {
    // let Base = () => useRoutes(routes)
    let Guard = useRoutesWithGuard('wf-token', routes)
    let navigate = useNavigate();
    return (
        <div id="app">

            <ul>
                <li>
                    <Link to='/home'>home</Link>
                </li>
                <li>
                    <Link to='/discover'>discover</Link>
                </li>
            </ul>

            {/* <Base /> */}
            <Guard />
            <button onClick={() => {
                navigate('/home?name=李雷', { replace: true, state: { name: '李雷' } })
            }}>点击导航到home</button>
        </div>
    )
}

export default App